package com.tanhua.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.AnalysisByDay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
public interface AnalysisByDayMapper extends BaseMapper<AnalysisByDay> {
    //查询累计用户
    @Select("select sum(num_registered) from tb_analysis_by_day")
    Long queryCumulativeUsers();

    //查询活跃用户,区域化
    @Select("select sum(num_active) from tb_analysis_by_day where record_date<=#{todayStr} and record_date>=#{passDay}")
    Long queryActivePass(@Param("todayStr") String todayStr, @Param("passDay") String passDay);


    //查询新增用户
    @Select("select coalesce(sum(num_registered),0) from tb_analysis_by_day where record_date=#{todayStr}")
    Integer queryRegisteredPass(@Param("todayStr") String todayStr);
    //查询活跃用户
    @Select("select coalesce(sum(num_active),0) from tb_analysis_by_day where record_date=#{todayStr}")
    Integer queryActiveLPass(@Param("todayStr") String todayStr);
    //查询次日留存用户数
    @Select("select coalesce(sum(num_retention1d),0) from tb_analysis_by_day where record_date=#{todayStr}")
    Integer queryRetention1dPass(@Param("todayStr") String todayStry);
}

